package com.heima.wemedia.controller.v1;


import com.heima.model.common.dtos.ResponseResult;
import com.heima.model.wemedia.pojos.WmUser;
import com.heima.wemedia.service.WmUserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/wemedia/api/v1/user")
@Api(value = "自媒体端管理",tags = "自媒体端管理")
public class WmUserController {

    @Autowired
    private WmUserService wmUserService;

    @ApiOperation("查询自媒体人")
    @GetMapping("/findByName/{name}")
    public ResponseResult<WmUser> findWmUserByName(@PathVariable String name){
        return wmUserService.findWmUserByName(name);
    }

    @ApiOperation("新增自媒体人")
    @PostMapping("/save")
    public ResponseResult<WmUser> saveUser(@RequestBody WmUser wmUser){
        return wmUserService.saveWmUser(wmUser);
    }
}
